var DutySectionSelector = {
	getView : function(c) {
		var a = this.initGridPanel();
		var b = new Ext.Window({
			title : "班次选择器",
			width : 630,
			height : 380,
			iconCls : "btn-clock",
			layout : "fit",
			border : false,
			items : [ a ],
			modal : true,
			buttonAlign : "center",
			buttons : [ {
				iconCls : "btn-ok",
				text : "确定",
				handler : function() {
					var g = Ext.getCmp("DutySectionSelGrid");
					var h = g.getSelectionModel().getSelections();
					var d = "";
					var e = "";
					for (var f = 0; f < h.length; f++) {
						if (f > 0) {
							d += ",";
							e += ",";
						}
						d += h[f].data.sectionId;
						e += h[f].data.sectionName;
					}
					if (c != null) {
						c.call(this, d, e);
					}
					b.close();
				}
			}, {
				text : "取消",
				iconCls : "btn-cancel",
				handler : function() {
					b.close();
				}
			}, {
				text : "休息",
				iconCls : "btn-relax",
				handler : function() {
					if (c != null) {
						c.call(this, "-", "休息");
					}
					b.close();
				}
			} ]
		});
		return b;
	},
	initGridPanel : function() {
		var d = new Ext.grid.CheckboxSelectionModel();
		var a = new Ext.grid.ColumnModel({
			columns : [ d, new Ext.grid.RowNumberer(), {
				header : "sectionId",
				dataIndex : "sectionId",
				hidden : true
			}, {
				header : "班次名称",
				dataIndex : "sectionName"
			}, {
				header : "开始签到",
				dataIndex : "startSignin1"
			}, {
				header : "上班时间",
				dataIndex : "dutyStartTime1"
			}, {
				header : "签到结束时间",
				dataIndex : "endSignin1"
			}, {
				header : "早退计时",
				dataIndex : "earlyOffTime1"
			}, {
				header : "下班时间",
				dataIndex : "dutyEndTime1"
			}, {
				header : "签退结束",
				dataIndex : "signOutTime1"
			} ],
			defaults : {
				sortable : true,
				menuDisabled : false,
				width : 100
			}
		});
		var b = new Ext.data.Store({
			proxy : new Ext.data.HttpProxy({
				url : __ctxPath + "/personal/listDutySection.do"
			}),
			reader : new Ext.data.JsonReader({
				root : "result",
				totalProperty : "totalCounts",
				id : "id",
				fields : [ {
					name : "sectionId",
					type : "int"
				}, "sectionName", "startSignin1", "dutyStartTime1",
						"endSignin1", "earlyOffTime1", "dutyEndTime1",
						"signOutTime1" ]
			})
		});
		b.load({
			params : {
				start : 0,
				limit : 25
			}
		});
		var c = new Ext.grid.GridPanel({
			id : "DutySectionSelGrid",
			title : "班级列表",
			store : b,
			trackMouseOver : true,
			disableSelection : false,
			loadMask : true,
			height : 360,
			cm : a,
			sm : d,
			viewConfig : {
				forceFit : true,
				enableRowBody : false,
				showPreview : false
			},
			bbar : new HT.PagingBar({
				store : b
			})
		});
		return c;
	}
};